package com.nandi.emergencyinspection.ui.activity


import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import com.nandi.emergencyinspection.R
import com.nandi.emergencyinspection.bean.UserInfoBean
import com.nandi.emergencyinspection.mvp.UserContract
import com.nandi.emergencyinspection.mvp.UserPresenter
import com.orhanobut.hawk.Hawk

import com.tbright.ktbaselibrary.mvp.BaseMvpActivity
import com.tbright.ktbaselibrary.utils.ActivityUtils
import io.rong.imkit.RongIM
import io.rong.imlib.RongIMClient
import kotlinx.android.synthetic.main.activity_user_info.*


class UserInfoActivity : BaseMvpActivity<UserPresenter>(), UserContract.UserView {
    override fun getLayoutId(): Int {
        return R.layout.activity_user_info
    }

    override fun initView(savedInstanceState: Bundle?) {
        left_icon.setOnClickListener {
            finish()
        }
        center_txt.text = "个人中心"

        val userInfoBean = Hawk.get<UserInfoBean>("USER")
        relName.text = userInfoBean.realname
        mobile.text = userInfoBean.phone
        juese.text = "角色：${userInfoBean.roleList?.get(0)?.roleName}"
        zhiwu.text = "职务：${userInfoBean.deptName}"
        message.setOnClickListener {
            startActivity(Intent(this, MessageActivity::class.java))
        }
        password_toggle.setOnClickListener {
            startActivity(Intent(this, PwdActivity::class.java))
        }
        version.setOnClickListener {
            startActivity(Intent(this, VersionActivity::class.java))
        }
        logout.setOnClickListener {
            ActivityUtils.finishAllActivities()
            startActivity(Intent(this, LoginActivity::class.java))
            RongIM.getInstance().logout()
        }
    }

    override var statusBarColor: Int = Color.parseColor("#28D0FD")

    override fun showResult(result: String) {

    }
}